From: Florian Müllner Date: Wed, 22 Jan 2020 13:45:15 +0000 (+0100) Subject: extensionSystem: Add hasUpdate state X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~781^2^2~101 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=375d1892bf294c70730062b5af0fb225cfc1881f;p=gnome-shell.git extensionSystem: Add hasUpdate state The current support for extension updates is half-baked at best. We are about to change that, and implement offline updates similar to gnome-software. As a first step, add a hasUpdate property to the extension state which will communicate available updates. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/945 --- diff --git a/js/misc/extensionUtils.js b/js/misc/extensionUtils.js index 3d01ad787..af2338f45 100644 --- a/js/misc/extensionUtils.js +++ b/js/misc/extensionUtils.js @@ -31,7 +31,15 @@ var ExtensionState = { UNINSTALLED: 99, }; -const SERIALIZED_PROPERTIES = ['type', 'state', 'path', 'error', 'hasPrefs', 'canChange']; +const SERIALIZED_PROPERTIES = [ + 'type', + 'state', + 'path', + 'error', + 'hasPrefs', + 'hasUpdate', + 'canChange', +]; /** * getCurrentExtension: diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js index f7aca5ce9..49e333fff 100644 --- a/js/ui/extensionSystem.js +++ b/js/ui/extensionSystem.js @@ -198,6 +198,15 @@ var ExtensionManager = class { return true; } + notifyExtensionUpdate(uuid) { + let extension = this.lookup(uuid); + if (!extension) + return; + + extension.hasUpdate = true; + this.emit('extension-state-changed', extension); + } + logExtensionError(uuid, error) { let extension = this.lookup(uuid); if (!extension) @@ -253,6 +262,7 @@ var ExtensionManager = class { path: dir.get_path(), error: '', hasPrefs: dir.get_child('prefs.js').query_exists(null), + hasUpdate: false, canChange: false, }; this._extensions.set(uuid, extension);